package cn.iocoder.yudao.module.call.mq.consumer.taskcalleelistimport;


import cn.iocoder.yudao.module.call.dal.mysql.cmacstask.CmAcsTaskPhoneMapper;
import cn.iocoder.yudao.module.call.mq.message.taskcalleelistimport.TaskCalleeListImportMessage;
import cn.iocoder.yudao.module.call.service.taskcalleelistnumber.CallTaskCalleeListNumberService;
import cn.iocoder.yudao.module.system.mq.message.product.ProductSendMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;

/**
 * 针对 {@link TaskCalleeListImportMessage} 的消费者
 *
 * @author PetePower
 */
@Component
@Slf4j
public class TaskCalleeListImportConsumer {

    @Resource
    private CallTaskCalleeListNumberService callTaskCalleeListNumberService;

    @Resource
    private CmAcsTaskPhoneMapper cmAcsTaskPhoneMapper;

    @EventListener
    @Async // Spring Event 默认在 Producer 发送的线程，通过 @Async 实现异步
    public void onMessage(TaskCalleeListImportMessage message) {
        log.info("[TaskCalleeListImportConsumer][消息内容({})]", message);
        callTaskCalleeListNumberService.importNumber(message);
    }

}
